package it.mauriziobasile.dietarapida;

import it.mauriziobasile.dietarapida.gui.DietaRapidaView;
import java.util.logging.Logger;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

public class DietaRapidaApp{
    private DietaRapidaView dietaRapidaView;

    public static Logger logger;
    static{
        System.setProperty("java.util.logging.config.file","logging.properties");
        logger=Logger.getLogger(DietaRapidaApp.class.getPackage().getName());
    }
    
    
    public void setDietaRapidaView(DietaRapidaView dietaRapidaView) {
        this.dietaRapidaView = dietaRapidaView;
    }
    public DietaRapidaView getDietaRapidaView() {
        return dietaRapidaView;
    }
    public static void main(String[] args) {
        try {
            DietaRapidaApp app = new DietaRapidaApp();
            DietaRapidaApp.logger.info("Avvio l'applicazione");
            app.setDietaRapidaView(new DietaRapidaView());
            app.getDietaRapidaView().setVisible(true);
            app.getDietaRapidaView().setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            
        } catch (Exception e) {
            logger.severe("Eccezione "+e);
            JOptionPane.showMessageDialog(null, "Errore\n"+e+"\nConsultare i logs");
        }
    }

}
